<#include "admin/include/inside_header.ftl" >
<link rel="stylesheet" href="${$baseUrl}public/static/jqtree/css/jquery.treegrid.css">
  <body>
  <@t.container title="资源列表" icon="cubes" >
  	       <!--operator-->
  	       <@t.btn_a name="增加" icon="plus" href="admin/resource/toAdd?id=${r.id}"/>
  		   <@t.dt id="treegird">
  		   		 <@t.dtheader checked="false">
						 <@t.column title="资源名称" />
						 <@t.column title="资源类型" />
						 <@t.column title="资源URL" />
				</@t.dtheader>
  			<@t.dtbody>
  				<!--主题-->
  				 <#list list as r>
					                <tr class="treegrid-${r.id}" <#if r.pId!=0 >treegrid-parent-${r.pId} </#if> ">
					                    <td>${r.text}</td>
					                    <td><#if r.type==1 >菜单 <#else> 功能点 </#if> </td>
					                    <td>${r.url}</td>
					                    <td>
					                   	    <@t.btn_b name="删除" size="btn-xs" icon="trash" onclick="batchDeleteFun('admin/resource/delete','${r.id}','您确认删除么？如果删除，该节点的子节点也会被删除！同时，将解除角色所存在的资源。');" />
											<@t.btn_a name="修改" size="btn-xs" icon="pencil" href="admin/resource/toAdd?id=${r.id}"/>
										</td>
					                </tr>
					                	 <#list r.children as r1 >
					                	 		<tr class="treegrid-${r1.id} <#if r1.pId!=0 >treegrid-parent-${r1.pId} </#if>">
													    <td>${r1.text}</td>
									                    <td><#if r1.type==1 >菜单 <#else> 功能点 </#if> </td>
									                    <td>${r1.url}</td>
									                    <td>
									                   	 	<@t.btn_b name="删除" size="btn-xs" icon="trash" onclick="batchDeleteFun('admin/resource/delete','${r1.id}','您确认删除么？如果删除，该节点的子节点也会被删除！同时，将解除角色所存在的资源。');" />
															<@t.btn_a name="修改" size="btn-xs" icon="pencil" href="admin/resource/toAdd?id=${r1.id}"/>
									                    </td>
									                </tr>
								                <#list r2.children as r1 >
						                	 		<tr class="treegrid-${r2.id} <#if r2.pId!=0 >treegrid-parent-${r2.pId} </#if>">
									                    <td>${r2.text}</td>
									                    <td><#if r2.type==1 >菜单 <#else> 功能点 </#if> </td>
									                    <td>${r2.url}</td>
									                    <td>
									                    	<@t.btn_b name="删除" size="btn-xs" icon="trash" onclick="batchDeleteFun('admin/resource/delete','${r2.id}','您确认删除么？如果删除，该节点的子节点也会被删除！同时，将解除角色所存在的资源。');" />
															<@t.btn_a name="修改" size="btn-xs" icon="pencil" href="admin/resource/toAdd?id=${r2.id}"/>
									                    </td>
									                </tr>
						                	   </#list>
					                	</#list>
				</#list>
  			</@t.dtbody>
  		</@t.dt>
  </@t.container>
	<#include  "admin/include/footer.ftl">
<script type="text/javascript" src="${$baseUrl}public/static/jqtree/js/jquery.treegrid.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $('#treegird').treegrid({
        	        'initialState': 'collapsed',
                    expanderExpandedClass: 'glyphicon glyphicon-minus',
                    expanderCollapsedClass: 'glyphicon glyphicon-plus'
       });
    });
</script>
</body>
</html>